package com.shengsiyuan.nio;

import java.nio.ByteBuffer;

/**
 * 类型化的get put方法
 */
public class NioTest05 {

    public static void main(String[] arg) {
        ByteBuffer buffer = ByteBuffer.allocate(64);

        buffer.putInt(10);
        buffer.putInt('A');
        buffer.putChar('好');
        buffer.putDouble(5.3);
        buffer.putLong(46798754L);

        buffer.flip();

        // 取出的时候要按照放入（类型）的顺序取，否则会报错

        System.out.println(buffer.getInt());
        System.out.println(buffer.getInt());

    }
}




